/*
 * @Author: your name
 * @Date: 2021-11-22 16:02:33
 * @LastEditTime: 2023-07-11 10:38:08
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \agricultural-production-web\src\api\production-batch-manage\create-production-batch\index.js
 */
/*
 * @Description: 创建生产批次
 */
import request from '@/utils/request'
export default {
  /**
   * @description: 获取所有表格列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   */
  gettablelist(params) {
    return request.post("/v3/batch/productionBatch/queryPageByCondition", {
      ...params
      // entity: {
      //   "deleteFlag": false,
      //   "farmingTypeNo": sessionStorage.farmingTypeNo
      // }
    });
  },
  // 添加接口
  addlist(params) {
    return request.post("/v3/batch/productionBatch/add", {
      ...params
    });
  },
  // 删除接口
  dellist(list) {
    // return request.get(`/batch/del/${params}`);
    return request.post(`/v3/batch/productionBatch/delListByNo`, {
      noList: list
    });
  },
  // 删除接口
  del(list) {
    // return request.get(`/batch/del/${params}`);
    return request.get(`/v3/batch/productionBatch/delByNo?no=${list}`);
  },
  // 修改接口
  editlist(params) {
    return request.post("/v3/batch/productionBatch/edit", {
      ...params
    });
  },
  // 条件查询
  querybyname(params) {
    return request.post("/v3/batch/productionBatch/queryByCondition", { ...params });
  },
  // 查询批次详细数据
  querybatch(no) {
    return request.get(`/v3/batch/productionBatch/queryByNo?no=${no}`);
  },
  // 添加一条编码数据，获取返回的编码
  addcode (noType) {
    let no = noType || 'PRODUCTION'
    return request.get(`/v3/noService/configCode/generateNo?noType=${no}`);
  },
  // 添加一条编码数据，获取返回的编码
  addcodeNum(num) {
    return request.get(`/v3/noService/configCode/generateNo?noType=PRODUCTION_SINGLE&num=${num}`);
  },
  // 单独查询单位名称
  queryunit(id) {
    return request.get(`/v3/templateTenant/unit/queryByNo?no=${id}`);
  },
  queryIfOverload(params) {
    return request.post("/batchFacilityMapper/queryIfOverload", params);
  },
  /**
  * @description: 条件查询承租户数据
  * @param {String}  *
  * @return {Object}
  */
  queryLessesByCondition(e) {
    return request.post("v3/lessee/lessee/queryByCondition", {
      contactStatus: e
      // organizationList: sessionStorage.organizationList
    })
  }
}
